package so.sao.code.service.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import so.sao.code.service.domain.entity.LookupTable;
import so.sao.code.service.infrastructure.enums.SEQ_TYPE;
import so.sao.code.service.repository.LookupTableDao;
import so.sao.code.service.service.LookupTableService;

@Service
public class LookupTableServiceImpl implements LookupTableService {

    @Autowired
    private LookupTableDao lookupTableDao;

    /**
     * 没有修改表结构在service做大小序号区分
     */
    @Override
    public LookupTable findAvailableRange(Long tagCount, SEQ_TYPE seq_type) {
        switch (seq_type) {
            case SMALL:
                return lookupTableDao.findBySmallSeq(tagCount);
            case BIG:
                return lookupTableDao.findByBigSeq(tagCount);
            default:
                return lookupTableDao.findByBigSeq(tagCount);
        }
    }
}
